package com.zlm.realtime.utils
import java.io.InputStreamReader
import java.util.Properties

/**
 * @author Harbour 
 * @date 2021-04-02 10:16
 */
object MyPropertiesUtils {

    val prop: Properties = new Properties()
    prop.load(new InputStreamReader(
        Thread.currentThread().getContextClassLoader.getResourceAsStream("config.properties"), "UTF-8"))

    def load(path: String): Properties = {
        val prop: Properties = new Properties()
        prop.load(new InputStreamReader(
            Thread.currentThread().getContextClassLoader.getResourceAsStream(path), "UTF-8"))
        prop
    }

    /**
     * 获取配置文件属性
     * @param key key
     * @return
     */
    def getProperty(key: String): String ={
        prop.getProperty(key)
    }

}
